package it.unina.lab.anm.activity;

import it.unina.lab.anm.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

public class SplashScreenActivity extends Activity {
	
	
	//protected boolean active = true;
	protected int splashTime = 3000; //in millisecondi
	
	
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    setContentView(R.layout.splash_screen);
	 
	    Thread splashTread = new Thread() {
	        @Override
	        public void run() {
	            try {
	                int waited = 0;
	                while(waited < splashTime) {
	                   sleep(100);
	                   waited += 100;
	                }
	            } catch(InterruptedException e) {
	                // do nothing
	            } finally {
	                finish();
	                startActivity(new Intent(getApplicationContext(), HomeActivity.class));
	            }
	        }
	    };
	    splashTread.start();
	}
}
